//引入二次封装的axios
import { request2 } from '@/axios/request'
import type {
  ClassificationTreeResponseData,
  MediumInstanceResponseData,
  SmallInstanceResponseData
} from './type'
//枚举地址
enum API {
  //获取黄冈市编码赋码分类树的接口
  CLASSIFICATIONTREE_URL = '/encodingClassification/bigAndMedium',
  //获取武穴市各实体中类实例化情况的接口
  MEDIUMINSTANCE_URL = '/encodingClassification/instancedCount',
  //获取中类下小类实例化情况的接口
  SMALLINSTANCE_URL = '/encodingClassification/subCategory/',
  //绑定责任单位的接口
  BINDINGDEPARTMENT_URL = '/encodingClassification/binding/',
  //解绑责任单位的接口
  UNBINDINGDEPARTMENT_URL = '/encodingClassification/unbinding/',
  //下载分类目录文件的接口
  DOWNLOADFILE_URL = '/encodingClassification/exportExcel'
}
//提交订单
// export const reqMissionState = () => request.post<any, SubmitOrder>(API.SUBMITORDER_URL + `${hoscode}/${scheduleId}/${patientId}`);

//获取黄冈市编码赋码分类树
export const reqClassificationTree = () =>
  request2.get<any, ClassificationTreeResponseData>(API.CLASSIFICATIONTREE_URL)

//获取武穴市各实体中类实例化情况
export const reqMediumInstance = () =>
  request2.get<any, MediumInstanceResponseData>(API.MEDIUMINSTANCE_URL)

export const reqSmallInstance = (code: string, pageNum: number, pageSize: number) =>
  request2.get<any, SmallInstanceResponseData>(
    API.SMALLINSTANCE_URL + code + `?pageNum=${pageNum}&pageSize=${pageSize}`
  )

export const reqBindingDepartment = (code: string, department: string) =>
  request2.post<any, any>(API.BINDINGDEPARTMENT_URL + code + `?department=${department}`)

export const reqUnbindingDepartment = (code: string) =>
  request2.post<any, any>(API.UNBINDINGDEPARTMENT_URL + code)

export const reqDownloadFile = () =>
  request2.get<any, Blob>(API.DOWNLOADFILE_URL, { responseType: 'blob' })
